// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store';
import 'element-ui/lib/theme-chalk/index.css';
// import './theme/element/index.css'

import axios from './plugins/axios'
import ElementUI from 'element-ui'
import moment from 'moment'
import localeEle from 'element-ui/lib/locale/lang/zh-CN' // lang i18n
Vue.use(ElementUI, {localeEle})

axios.defaults.withCredentials = true;
Vue.prototype.$http = axios //axios 改写为 Vue 的原型属性
Vue.prototype.$confirm = ElementUI.MessageBox.confirm
Vue.prototype.$message = ElementUI.Message
Vue.config.productionTip = false
// 全局处理日期方法
Vue.prototype.$moment=moment

// 路由守卫
router.beforeEach((to, from, next) => {
  if (to.name == 'Login') {
    sessionStorage.clear()
  }
  next()
})
/* eslint-disable no-new */
new Vue({
  router,
  store,
  render: h => h(App),
  mounted () {
    // document.dispatchEvent(new Event('render-event'))
    setTimeout(() => {
      document.dispatchEvent(new Event('render-event'))
    }, 30000)
  }
}).$mount("#app")
